﻿#ifndef TCPSERVEMANAGER_H
#define TCPSERVEMANAGER_H
#include <QTcpServer>
#include <QVector>
#include <QTcpSocket>
#include "CommonDefine.h"
#include "NewTcpClient.h"

class TcpServeManager :public QObject {
    Q_OBJECT
    QML_PROPERTY_(port, QString, "9528")
    QML_PROPERTY_(listenFlag, bool, false)

public:
    TcpServeManager();

    Q_INVOKABLE void    openListen();
    Q_INVOKABLE void    closeListen();

public slots:
    void                newConnectSlot();
    //根据用户名获取联系的
    NewTcpClient*       getClientPtr(const QString &account);


private:
    QTcpServer                  mTcpServer;
    //通信对象都放这里
    QVector<NewTcpClient::ptr>  mClientVec;
};

#endif // TCPSERVEMANAGER_H
